File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import { verifySession } from '@/lib/auth/dal';
import { fetchCommonCodes } from '@/lib/data/repositories/common-code-repository';
import { fetchMerchantDetail } from '@/lib/data/repositories/merchant-detail-repository';
import { fetchMerchantProducts } from '@/lib/data/repositories/merchant-product-repository';
import { CODE_GROUP } from '@/lib/domain/common-code';
import { MerchantDetailForm } from './_components/merchant-detail-form';
export const metadata: Metadata = { title: '가맹몰 상세 등록·수정' };
export const dynamic = 'force-dynamic';
interface PageProps {
params: Promise<{ frcsNo: string }>;
}
export default async function Page({ params }: PageProps) {
await verifySession();
const { frcsNo } = await params;
const detail = await fetchMerchantDetail(frcsNo);
if (!detail) {
notFound();
}
// 상세가 없으면 백엔드가 메뉴 조회를 빈 목록으로 답한다 — 따로 가릴 것 없다.
const [products, categories] = await Promise.all([
detail.hasDetail ? fetchMerchantProducts(frcsNo) : Promise.resolve([]),
fetchCommonCodes(CODE_GROUP.merchantType),
]);
return <MerchantDetailForm detail={detail} products={products} categories={categories} />;
}